<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        div {
            margin: 30px;
        }

        /* 
            宽高都设为0，让下面的边框设为实线把高度顶起来，
            其他的设为 透明transparent,
            就可以在视觉上看上去是一个正三角形
        */
        .top {
            width: 0;
            height: 0;
            border-left: 50px solid transparent;
            border-right: 50px solid transparent;
            border-bottom: 100px solid red;
        }


        .right {
            width: 0;
            height: 0;
            top: 0;
            bottom: 0;
            border-bottom: 50px solid transparent;
            border-right: 50px solid transparent;
            border-top: 50px solid transparent;
            border-left: 100px solid yellow;
        }


        .left {
            width: 0;
            height: 0;
            top: 0;
            bottom: 0;
            border-bottom: 50px solid transparent;
            border-left: 50px solid transparent;
            border-top: 50px solid transparent;
            border-right: 100px solid blue;
        }

        .bom {
            width: 0;
            height: 0;
            border-left: 50px solid transparent;
            border-right: 50px solid transparent;
            border-top: 100px solid pink;
        }
    </style>
</head>

<body>
    <!-- 正三角形 -->
    <div class="top"></div>


    <!-- 朝左边的 -->
    <div class="left"></div>


    <!-- 朝右边的 -->
    <div class="right"></div>

    <!-- 朝下的 -->
    <div class="bom"></div>


</body>

</html>